package com.nbsaas.boot.ad.rest.convert;

import com.nbsaas.boot.ad.data.entity.AdPosition;
import com.nbsaas.boot.ad.api.domain.response.AdPositionResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;
import java.util.HashMap;
import java.util.Map;
/**
* 广告位-实体对象转化成响应对象
*/

public class AdPositionResponseConvert  implements Converter<AdPositionResponse,AdPosition> {

    @Override
    public AdPositionResponse convert(AdPosition source) {
        AdPositionResponse  result = new  AdPositionResponse();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getDisplayDevice()!=null){
                    Map<Integer,String> DisplayDeviceMap=new HashMap<>();
                        DisplayDeviceMap.put(1,"电脑端");
                        DisplayDeviceMap.put(2,"手机端");
                    String label=  DisplayDeviceMap.get(source.getDisplayDevice());
                    result.setDisplayDeviceName(label);
                    }
                    result.setDisplayDevice(source.getDisplayDevice());
        return result;
    }

}

